ci: set up Spotless linting in CI (#351)#366
Conversation
|
Thanks @KaleabArgaw for this! I'll give it a look through later today or tomorrow! I am going to have copilot do an automated review of it too, but please don't take any actions yet based on what it says. I'm really just testing it out to see if I trust it or not :) |
|
@all-contributors add @KaleabArgaw for code documentation |
|
I've put up a pull request to add @KaleabArgaw! 🎉 |
There was a problem hiding this comment.
Pull request overview
This PR integrates Spotless code linting into the CI pipeline to enforce consistent code formatting across the Java codebase. The implementation uses an incremental rollout strategy via ratchetFrom("origin/main"), which checks only files changed from the main branch. This allows for gradual adoption without requiring all existing code to be reformatted immediately.
Changes:
- Adds Spotless Gradle plugin (version 7.2.1) to the project dependencies
- Configures Spotless in the shared Java convention plugin with basic formatting rules (remove unused imports, format annotations, trim trailing whitespace, end with newline)
- Adds a new
lintCI job that runs Spotless formatting checks on all pull requests - Updates CONTRIBUTING.md with instructions for running Spotless locally
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Adds Spotless version (7.2.1) and plugin dependency declaration to the version catalog |
| buildSrc/build.gradle.kts | Adds Spotless Gradle plugin as a buildSrc dependency, making it available to convention plugins |
| buildSrc/src/main/kotlin/docling-java-shared.gradle.kts | Applies Spotless plugin and configures it with ratchetFrom strategy and basic Java formatting rules |
| .github/workflows/build.yml | Adds new lint job that checks out code with full history (fetch-depth: 0), runs spotlessApply, and verifies no formatting changes are needed |
| CONTRIBUTING.md | Documents new Spotless commands (spotlessCheck and spotlessApply) for contributors |
:java_duke: JaCoCo coverage report
|
|
||||||||||||||
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
f41a996 to
0169818
Compare
edeandrea
left a comment
There was a problem hiding this comment.
See comments in-line.
I'd also like @ThomasVitale to take a look.
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
feb364e to
ad6b1db
Compare
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
|
Hi @KaleabArgaw thank you so much for this! I've just downloaded & built this PR locally and purposefully introduced some things that should break the spotless check. When I run |
ad6b1db to
67ee6e3
Compare
|
Hey @edeandrea i removed the on build fail that's why you can check now locally. |
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
|
Hi @KaleabArgaw thank you so much for this! I've thought about this PR a lot over the weekend. I think what I'm going to do for now is merge it, but only with the import order turned on. I think I as the maintainer need to come up with "What are the coding standards?" :) So if you don't mind, I may push one or 2 "cleanup" commits to your work and then merge it. |
|
Hey @edeandrea no problem and thanks for the opportunity. |
…formatting rules - Introduced `.spotless/import-order.txt` for defining import order. - Updated Spotless configuration in `docling-java-shared.gradle.kts` to enforce import order. - Removed conflicting formatting rules from `.editorconfig`. Signed-off-by: Eric Deandrea <eric.deandrea@gmail.com>
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
…t history Signed-off-by: Eric Deandrea <eric.deandrea@gmail.com>
|
@all-contributors add @KaleabArgaw for code |
|
@KaleabArgaw already contributed before to code |
|
HTML test reports are available as workflow artifacts (zipped HTML). • Download: Artifacts for this run |
Fixes #351